package com.jiuzhou.surery.db;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.jiuzhou.surery.beans.Item;

import io.micrometer.common.lang.NonNull;



public class ItemRowMapper implements RowMapper<Item> {
    
    public Item mapRow(@NonNull ResultSet rs, int rowNum) throws SQLException {
        Item item = new Item();
        item.setId(rs.getInt("id"));
        item.setName(rs.getString("name"));
        item.setAge(rs.getInt("age"));
        item.setSex(rs.getString("sex"));
        item.setPhone(rs.getString("phone"));
        item.setEmail(rs.getString("email"));
        item.setAddress(rs.getString("address"));
        
        String cloudserverStr = rs.getString("cloud_server");
        if (cloudserverStr != null) {
            
            item.setCloudserver(cloudserverStr.split(","));
            
        }
        
        item.setCity(rs.getString("city"));
        item.setWorkYear(rs.getInt("work_years"));
       
        item.setSalary(rs.getDouble("salary"));
        item.setRemark(rs.getString("remark"));
        item.setPhoto(rs.getString("photo"));

        return item;
    }
}